﻿using System;
using System.Windows.Media.Imaging;

namespace VecDraw.Resources
{
    public static class ImageResource
    {
        public static BitmapSource GetImage(string name)
        {
            BitmapImage src = new BitmapImage();
            src.BeginInit();
            //src.UriSource = new Uri("/VecDraw.Resources;component/Images/" + name, UriKind.Relative);
            src.UriSource = new Uri("pack://application:,,,/VecDraw.Resources;component/Images/" + name, UriKind.Absolute);
            src.CacheOption = BitmapCacheOption.OnLoad;
            src.EndInit();
            return src;
        }
    }
}
